<!DOCTYPE html>
  <html>
  <head>
      <meta charset="utf-8">
      <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
      <title>双良</title>
      <link rel="stylesheet" type="text/css" href="css/api.css" />
      <link rel="stylesheet" type="text/css" href="css/common.css" />
      <link rel="stylesheet" type="text/css" href="css/aui.css" />
    	<link rel="stylesheet" type="text/css" href="css/aui-pull-refresh.css" />
      <link rel="stylesheet" type="text/css" href="css/index.css" />
      <style>
          html, body {width: 100%;min-height: 100%;background: #ffffff;}



          [v-cloak] {
              display: none;
          }

      </style>
  </head>
  <body>
<div id="app" >
    <footer class="aui-bar aui-bar-tab" id="footer">
    <div class="aui-bar-tab-item aui-active " tapmode >
        <i class="aui-iconfont aui-icon-home"></i>
        <div class="aui-bar-tab-label">司机接单</div>
    </div>
    <div class="aui-bar-tab-item" tapmode>
        <i class="aui-iconfont aui-icon-star"></i>
        <div class="aui-bar-tab-label">交接</div>
    </div>
    <div class="aui-bar-tab-item" tapmode>
        <div class="aui-badge">99</div>
        <i class="aui-iconfont aui-icon-my"></i>
        <div class="aui-bar-tab-label">个人中心</div>
    </div>

  </footer>

</div>
  </body>
  <script type="text/javascript" src="script/api.js"></script>
  <script type="text/javascript" src="script/zepto.js"></script>
  <script type="text/javascript" src="script/vue.min.js"></script>
  <script type="text/javascript" src="script/utils.js"></script>
  <script type="text/javascript" src="script/common.js"></script>
  <script type="text/javascript" src="script/aui-tab.js"></script>
  <script type="text/javascript" src="script/aui-scroll.js"></script>
  <script type="text/javascript" src="script/aui-pull-refresh.js"></script>
  <script type="text/javascript">

  var footer = $api.byId('footer');
  var footerPos = $api.offset(footer);

      apiready = function(){
        //setRefresh()
        openframeinstance('one_frame/index.html',0)
      };
      //刷新
      function setRefresh() {
          var pullRefresh = new auiPullToRefresh({
              container: document.querySelector('.aui-refresh-content'),
              triggerDistance: 100
          }, function(ret) {

              if (ret.status == "success") {
                  setTimeout(function() {
                      pullRefresh.cancelLoading(); //刷新成功后调用此方法隐藏
                  }, 1500)
              }
          })
      }



      var tab = new auiTab({
          element:document.getElementById("footer"),
          index:1,
          repeatClick:false
      },function(ret){

        switch(ret.index)
        {
          case 1:
            openframeinstance('one_frame/index.html',0)
            break;
          case 2:
            openframeinstance('two_frame/index.html',0)
            break;
          case 3:
            openframeinstance('three_frame/index.html',0)
            break;
          default:
            console.log('home')
            break;

        }

          // api.toast({
          // 		msg:ret.index,
          // 		duration: 2000,
          // 		location: 'center'
          // });
      });
      // 隐藏所有的一级frame
      function hideAllFrame()
      {
          api.setFrameAttr({
              name: 'one_frame',
              hidden:true
          });
          api.setFrameAttr({
              name: 'two_frame',
              hidden:true
          });

      }
      // 展示指定的frame
      function showframe(type)
      {
          api.setFrameAttr({
              name: type,
              hidden:false
          });
      }

      // 打开frame
      function openframeinstance( frame, marginTop)
      {
          hideAllFrame()
          api.openFrame ({
            reload: true,
              name: frame,
              url: './html/' + frame +'',
              rect:{
                  x:0,
                  y:0,
                  w:'auto',
                  h:api.frameHeight - marginTop - (footerPos.h)
              },
              pageParam: {name:'1'},
              // bounces: isBounce,
              bounces: false,
              vScrollBarEnabled:false,
              hScrollBarEnabled:false,
              delay:200
          });
      }

  </script>
  </html>
